<?php require_once('../src/session_start.inc.php'); ?>
<?php
require_once('../src/define.inc.php');
require_once('../src/functions.php');
require_once('../src/type_transaction.class.php');
require_once('../src/type_bien.class.php');
require_once('../src/localisation.class.php');

if (isset($_POST) && !empty($_POST))
{
	$errors = treatContactForm($_POST);
	if (empty($errors))
	{
		if (sendContactMail($_POST, true)) {
			header('Location: message_confirm.php');
		} else {
			$error = ERROR_MSG;
			log_error("L'envoi du formulaire de PROPOSITION de BIEN n'a pas pu se faire. Données à envoyer :" . npr($_POST));
		}
	}
}
?>
<?php $page='proposer'; require_once('../layout/header.php'); ?>

<div id="leftColumn">
	<h2>Proposez-nous votre bien !</h2>
	<p class="justify">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec congue nunc <a href="#">vitae lectus</a>. Donec ipsum felis, dapibus et, mollis eget, egestas at, nulla. Cras suscipit iaculis nisl.</p>

<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
	<fieldset>
		<legend>Caractéristiques de votre bien</legend>
        <p>
<?php
$type_transaction_id = false;
if (isset($_POST['type_transaction_id']))
    $type_transaction_id = $_POST['type_transaction_id'];
$type_transaction = new type_transaction();
echo $type_transaction->getSelect($type_transaction_id);
?>
        </p>
        <p>
<?php
$type_bien_id = false;
if (isset($_POST['type_bien_id']))
    $type_bien_id = $_POST['type_bien_id'];
$type_bien = new type_bien();
echo $type_bien->getSelect($type_bien_id);
?>
        </p>
        <p>
<?php
$localisation_id = false;
if (isset($_POST['localisation_id']))
    $localisation_id = $_POST['localisation_id'];
$localisation = new localisation();
echo $localisation->getSelect($localisation_id);
?>
        </p>
        <p>
            <label for="nb_piece">Nombre de pièces</label>
            <input type="text" id="nb_piece" name="nb_piece" value="<?php if (isset($_POST['nb_piece'])) echo $_POST['nb_piece']; ?>" />
        </p>
        <p>
            <label for="surface">Surface</label>
            <input type="text" id="surface" name="surface" value="<?php if (isset($_POST['surface'])) echo $_POST['surface']; ?>" />
        </p>
	</fieldset>
	<?php $short=false; require_once('./contact.inc.php') ?>
	<p class="submit">
		<input type="submit" class="submit" id="submit" name="submit" value="Envoyer" />
	</p>
</form>
</div>
<div id="rightColumn">
	<h3>Nos collaborateurs</h3>
	<p><img src="<?php echo IMAGE_DIR . 'propose_photo.jpg' ?>" alt="proposer un bien immobilier en algerie"/></p>
</div>

<?php require_once('../layout/footer.php'); ?>